Make materialized query more helpful - #8000
Conversation
labkey-nicka
left a comment
There was a problem hiding this comment.
Main thing to test is that this analyze does not take exceedingly long to execute for large tables.
| } | ||
| } | ||
|
|
||
| /** SELECT INTO leaves the table with no statistics, so the planner guesses until autovacuum eventually analyzes it. */ |
There was a problem hiding this comment.
Well, TIL that running ANALYZE after SELECT INTO or CREATE TABLE AS is considered standard practice in Postgres.
Yes, I'll be looking at that carefully when this gets deployed. I considered moving |
On a ~5.75 minute materialization, the ANALYZE took 1.6 seconds. I'm OK with that. |
Rationale
Analysis shows that our current 1 hour retention for materialized tables is way too short for sample type scenarios. Additionally, without doing an analyze the DB may not be making good query plan choices.
Changes
ANALYZEmaterialized table as part of its creationTasks
Manual TestingN/A